<template>
  <view class="main-container">
    <!-- 顶部标题 -->
    <view class="header">
      <text class="title">校园帮</text>
      <text class="subtitle">让校园生活更便捷</text>
    </view>

    <!-- 服务卡片 -->
    <view class="services-grid">
      <!-- 快递代取 -->
      <view class="service-card" @click="goToExpressPickup">
        <view class="service-icon">📦</view>
        <text class="service-title">快递代取</text>
        <text class="service-desc">专业代取，安全送达</text>
      </view>

      <!-- 外卖代取 -->
      <view class="service-card" @click="goToFoodPickup">
        <view class="service-icon">🍱</view>
        <text class="service-title">外卖代取</text>
        <text class="service-desc">美食不等待</text>
      </view>

      <!-- 闲置交易 -->
      <view class="service-card" @click="goToSecondHand">
        <view class="service-icon">🛍️</view>
        <text class="service-title">闲置交易</text>
        <text class="service-desc">物尽其用</text>
      </view>

      <!-- 宿舍小店 -->
      <view class="service-card" @click="goToDormShop">
        <view class="service-icon">🏪</view>
        <text class="service-title">宿舍小店</text>
        <text class="service-desc">零食生活</text>
      </view>
    </view>

    <!-- 快捷入口 -->
    <view class="quick-actions">
      <button class="action-btn primary" @click="goToExpressPickup">
        <text class="btn-text">立即代取快递</text>
      </button>
      <button class="action-btn secondary" @click="goToOrders">
        <text class="btn-text">查看我的订单</text>
      </button>
    </view>
  </view>
</template>

<script setup lang="ts">
// 页面跳转方法
const goToExpressPickup = () => {
  uni.navigateTo({
    url: '/pages/express-pickup/express-pickup'
  })
}

const goToFoodPickup = () => {
  uni.navigateTo({
    url: '/pages/food-pickup/food-pickup'
  })
}

const goToSecondHand = () => {
  uni.showToast({
    title: '功能开发中',
    icon: 'none'
  })
}

const goToDormShop = () => {
  uni.showToast({
    title: '功能开发中',
    icon: 'none'
  })
}

const goToOrders = () => {
  uni.switchTab({
    url: '/pages/orders/orders'
  })
}
</script>

<style scoped>
.main-container {
  background-color: #f5f5f5;
  min-height: 100vh;
  padding: 40rpx 30rpx;
}

/* 顶部标题 */
.header {
  text-align: center;
  margin-bottom: 60rpx;
}

.title {
  display: block;
  font-size: 48rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 20rpx;
}

.subtitle {
  display: block;
  font-size: 28rpx;
  color: #666;
}

/* 服务网格 */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30rpx;
  margin-bottom: 60rpx;
}

.service-card {
  background-color: #fff;
  border-radius: 20rpx;
  padding: 40rpx 30rpx;
  text-align: center;
  box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.service-card:active {
  transform: scale(0.95);
}

.service-icon {
  font-size: 60rpx;
  margin-bottom: 20rpx;
}

.service-title {
  display: block;
  font-size: 32rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 15rpx;
}

.service-desc {
  display: block;
  font-size: 24rpx;
  color: #666;
}

/* 快捷操作 */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 20rpx;
}

.action-btn {
  height: 88rpx;
  border: none;
  border-radius: 10rpx;
  font-size: 32rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn.primary {
  background-color: #f44336;
  color: #fff;
}

.action-btn.secondary {
  background-color: #fff;
  color: #333;
  border: 2rpx solid #ddd;
}

.btn-text {
  font-size: 32rpx;
  font-weight: 500;
}
</style>